//详情View
import React, {Component} from 'react';
import {
    View,
    StyleSheet,
    Text,
    TouchableOpacity
} from 'react-native';
import { inject, observer } from 'mobx-react'

@inject("categoryGoods","cartGoods")
@observer
export default class ItemDetail extends Component {
    constructor(props){
        super(props);
    }
    render(){
        const {params} = this.props.navigation.state;
        const {categoryGoods,cartGoods} = this.props;
        return(
            <View>
                <Text>购物车：{cartGoods.getCartCount}</Text>
                <Text>名称：{params.goods.name}</Text>
                <Text>价格：{params.goods.price}</Text>
                <TouchableOpacity onPress={() =>{
                    cartGoods.AddToCart(params.goods);
                }}>
                    <Text>加入购物车</Text>
                </TouchableOpacity>
            </View>
        )
    }
}